import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.WindowConstants;

import java.awt.Rectangle;
import javax.swing.ImageIcon;
import javax.swing.JLabel;


public class trade5GUI extends JFrame {

	private static final long serialVersionUID = 1L;
	private JPanel jContentPane = null;
	private JButton jButton = null;
	private JButton jButton1 = null;
	private JButton jButton2 = null;
	private JButton jButton3 = null;
	private JButton jButton4 = null;
	private JButton jButton5 = null;
	private JLabel jLabel = null;
	private Players[] player;
	private Deeds[] deeds;
	private int playerchosen;
	private int playerturn;
	private JFrame frame;
	private JButton jButton6 = null;
	private PropertyEvent property;
	/**
	 * This is the default constructor
	 */
	public trade5GUI(PropertyEvent property, int playerchosen, int playerturn,Players[] player,Deeds[] deeds,JFrame frame) {
		super();
		this.property=property;
		this.playerchosen=playerchosen;
		this.playerturn=playerturn;
		this.player=player;
		this.deeds=deeds;
		this.frame=frame;
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(855, 600);
		this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE) ;
		this.setContentPane(getJContentPane());
		this.setTitle("JFrame");
		this.setVisible(true);
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jLabel = new JLabel();
			jLabel.setBounds(new Rectangle(429, 523, 16, 22));
			jLabel.setText("4");
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.add(getJButton(), null);
			jContentPane.add(getJButton1(), null);
			jContentPane.add(getJButton2(), null);
			jContentPane.add(getJButton3(), null);
			jContentPane.add(getJButton4(), null);
			jContentPane.add(getJButton5(), null);
			jContentPane.add(jLabel, null);
			jContentPane.add(getJButton6(), null);
		}
		return jContentPane;
	}

	/**
	 * This method initializes jButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton() {
		if (jButton == null) {
			jButton = new JButton();
			if(deeds[24].getOwner()!=player[this.playerturn].getName()){
				jButton.setEnabled(false);
			}
			jButton.setBounds(new Rectangle(41, 34, 167, 203));
			jButton.setIcon(new ImageIcon(getClass().getResource("/Images/Pens.jpg")));
			jButton.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					trade6GUI trade  = new trade6GUI(property,24,playerchosen,playerturn,player,deeds,frame);
					setVisible(false);
				}
			});
		}
		return jButton;
	}

	/**
	 * This method initializes jButton1	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton1() {
		if (jButton1 == null) {
			jButton1 = new JButton();
			if(deeds[25].getOwner()!=player[this.playerturn].getName()){
				jButton1.setEnabled(false);
			}
			jButton1.setBounds(new Rectangle(249, 32, 168, 211));
			jButton1.setIcon(new ImageIcon(getClass().getResource("/Images/ShortLine.jpg")));
			jButton1.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					trade6GUI trade  = new trade6GUI(property,23,playerchosen,playerturn,player,deeds,frame);
					setVisible(false);
				}
			});
		}
		return jButton1;
	}

	/**
	 * This method initializes jButton2	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton2() {
		if (jButton2 == null) {
			jButton2 = new JButton();
			if(deeds[26].getOwner()!=player[this.playerturn].getName()){
				jButton2.setEnabled(false);
			}
			jButton2.setBounds(new Rectangle(454, 31, 168, 209));
			jButton2.setIcon(new ImageIcon(getClass().getResource("/Images/ParkPlace.jpg")));
			jButton2.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					trade6GUI trade  = new trade6GUI(property,23,playerchosen,playerturn,player,deeds,frame);
					setVisible(false);
				}
			});
		}
		return jButton2;
	}

	/**
	 * This method initializes jButton3	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton3() {
		if (jButton3 == null) {
			jButton3 = new JButton();
			if(deeds[27].getOwner()!=player[this.playerturn].getName()){
				jButton3.setEnabled(false);
			}
			jButton3.setBounds(new Rectangle(647, 33, 170, 205));
			jButton3.setIcon(new ImageIcon(getClass().getResource("/Images/BoardWalk.jpg")));
			jButton3.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					trade6GUI trade  = new trade6GUI(property,23,playerchosen,playerturn,player,deeds,frame);
					setVisible(false);
				}
			});
		}
		return jButton3;
	}

	/**
	 * This method initializes jButton4	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton4() {
		if (jButton4 == null) {
			jButton4 = new JButton();
			jButton4.setBounds(new Rectangle(351, 506, 50, 54));
			jButton4.setText("<");
			jButton4.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					trade4GUI gui = new trade4GUI(property,playerchosen,playerturn,player,deeds,frame);
					setVisible(false);
				}
			});
		}
		return jButton4;
	}

	/**
	 * This method initializes jButton5	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton5() {
		if (jButton5 == null) {
			jButton5 = new JButton();
			jButton5.setEnabled(false);
			jButton5.setBounds(new Rectangle(465, 505, 51, 54));
			jButton5.setText(">");
		}
		return jButton5;
	}

	/**
	 * This method initializes jButton6	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton6() {
		if (jButton6 == null) {
			jButton6 = new JButton();
			jButton6.setBounds(new Rectangle(576, 505, 106, 55));
			jButton6.setText("cancel trade");
			jButton6.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					frame.setEnabled(true);
					setVisible(false);
				}
			});
		}
		return jButton6;
	}

}
